﻿/*
 * QWine Queue Machine (Special build for Immigration Office)
 * Copyright (C) 2010 Wish Enterprise Development Team

 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 * Contact Us:
 * E-Mail   : contact@wishenterprise.com
 * 
 * */

using System.Threading;
using System.Windows.Forms;
using QWRepository;

namespace QWScreenPanel.Model
{
    /// <summary>
    /// Number Module
    /// </summary>
    public partial class QWNumber : Form
    {

        /// <summary>
        /// Initializes a new instance of the <see cref="QWNumber"/> class.
        /// </summary>
        public QWNumber()
        {
            InitializeComponent();

            // play BELL
            var tbell = new Thread(PlayBellSound);
            tbell.Start();
        }

        /// <summary>
        /// Plays the bell sound.
        /// </summary>
        private static void PlayBellSound()
        {
            WavPlayer.PlaySound("bell");
        }

        /// <summary>
        /// Plays the specified loket.
        /// </summary>
        /// <param name="loket">The loket.</param>
        /// <param name="loketdesc">The loketdesc.</param>
        /// <param name="nomor">The nomor.</param>
        public void Play(string loket, string loketdesc, string nomor)
        {
            // play SOUNDS
            lblNomor.Text = nomor;
            lblHeader.Text = string.Format(">>>>  Loket: {0}  <<<<", loketdesc);
            Application.DoEvents();
            WavPlayer.PlaySound("antriannomor");
            WavPlayer.PlaySound("char" + nomor.Substring(0, 1));
            WavPlayer.PlaySound("num" + nomor.Substring(2, 1));
            WavPlayer.PlaySound("num" + nomor.Substring(3, 1));
            WavPlayer.PlaySound("num" + nomor.Substring(4, 1));
            WavPlayer.PlaySound("diloket");
            WavPlayer.PlaySound("num" + loketdesc.ToLower().Trim());
        }

        #region Nested type: DelegateThis

        /// <summary>
        /// DelegateThis
        /// </summary>
        private delegate void DelegateThis();

        #endregion
    }
}